package com.ycyun.admin.dao;

import com.ycyun.admin.model.Role;
import org.apache.ibatis.annotations.*;

import java.util.Map;

/**
 * @Author: 哦谢特谢特
 * @Date: 2018/5/18 14:32
 * @Description:
 */
@Mapper
public interface RoleDao {

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into sys_role (name, description, createTime, updateTime ),  values(#{name}, #{description}, now(), now())")
    int saveRole(Role role);

    int count(@Param("params") Map<String, Object> params);

    @Select("select * from sys_role t where t.id = #{id}")
    Role getById(Long id);

    @Select("select * from sys_role t where t.name = #{name}")
    Role getRole(String name);

    @Update("update t")
}
